package com.frog.service.friend.service.factory;


import com.frog.service.friend.enums.FriendTypeEnum;
import com.frog.service.friend.service.relation.Relation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@Component
public class RelationFactory {

    @Autowired
    private final Map<String, Relation> strategyMap = new ConcurrentHashMap<>();

    public Relation getServiceInstance(FriendTypeEnum friendTypeEnum) {
        switch (friendTypeEnum) {
            case addFollow:
            case cancelFollow:
                return strategyMap.get("friendRelationInstance");
            case addBlock:
            case cancelBlock:
                return strategyMap.get("blockRelationInstance");
            case addBest:
            case cancelBest:
                return strategyMap.get("bestFriendRelationInstance");
        }
        return null;
    }

}